<template>
  <div class="hFull flex column overflow-y true-or-false-image-question-body">
    <div class="equal">
      <div class="radioBg pra">
        <!-- 题目 -->
        <div class="head">
          <div class="flex headBox aicenter jccenter">
            <div class="tips mr10"></div>
            <div class="equal fz16 overflow-y qtText">
              <span v-html="getGuideHtml"></span>
            </div>
          </div>
        </div>
        <!-- 问题 -->
        <div class="decide">
          <div class="fz20 flex aicenter jccenter">
            <div class="equal txtc" v-for="stem in question.stem_pic" :key="stem">
                <img :src="imgUrl+stem" />
            </div>
          </div>
        </div>
        <!-- 答案 -->
        <div class="judge">
          <div class="flex aicenter jccenter">
            <div
              class="equal yes fzWhite20"
              @click="selectAnswer('T')"
              v-bind:class="{onlink:'T'==answer}"
            ></div>
            <div
              class="equal wrong fzWhite20"
              @click="selectAnswer('F')"
              v-bind:class="{onlink:'F'==answer}"
            ></div>
            <div class="submit" @click="submit()"></div>
          </div>
        </div>
      </div>
    </div>
    <!-- 弹出 -->
    <div class="black none"></div>
    <div class="error none">
      <div class="flex aicenter jccenter errorImg">
        <img src="../assets/images/errorImg.png" alt />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["submitAnswer", "question", "imgUrl"],
  data() {
    return {
      answer: "",
    };
  },
  created() {
    console.log(this.question);
  },
  computed: {
      getGuideHtml() {
        // return value.replace(/1[3456789]\d{9}/g,function(str1){
        //      return '<a href=\'tel:'+str1+'\'>'+str1+'</a>';
        //  });
        
        return this.question.guide;
    },
  },
  methods: {
    selectAnswer(answer) {
      this.answer = answer;
    },
    submit() {
      this.submitAnswer(this.answer);
      this.answer = null;
    },
  },
};
</script>
<style scoped>
.true-or-false-image-question-body {
  width: 100%;
  position: relative;
  background: url(../assets/images/judgeBg.png) no-repeat center center;
  background-size: 100% 100%;
}
.head {
  position: absolute;
  top: 0.2rem;
  left: 0;
  right: 0;
  padding: 0 0.5rem;
}
.headBox {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 0.1rem;
  border: 0.1rem solid #fff;
}
.tips {
  width: 0.38rem;
  height: 0.33rem;
  display: block;
  background: url(../assets/images/newsIcon.png) no-repeat;
  background-size: 100%;
}
.yes {
  width: 0.45rem;
  height: 1rem;
  padding: 0 0.1rem;
  background: url(../assets/images/yes.png) no-repeat center center;
  background-size: 0.45rem 1rem;
  margin: 0 0.2rem;
  text-align: center;
}
.wrong {
  width: 0.45rem;
  height: 1rem;
  padding: 0 0.1rem;
  background: url(../assets/images/wrong.png) no-repeat center center;
  background-size: 0.45rem 1rem;
  margin: 0 0.2rem;
  text-align: center;
}
.judge {
  padding: 0 0.5rem 0 1.2rem;
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
}
.decide {
  width: 46%;
  position: absolute;
  top: 38%;
  left: 26%;
  bottom: 34%;
  right: 28%;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-direction: column;
  overflow-y: auto;
}
.submit {
  width: 0.98rem;
  height: 0.98rem;
  background: url(../assets/images/submitBtn.png) no-repeat center center;
  background-size: 100% 100%;
  cursor: pointer;
  margin-left: 0.2rem;
}
.qtText {
  height: 0.5rem;
  display: flex;
  justify-content: center;
  flex-direction: column;
}
</style>